﻿using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using SyncWayBill.Service;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.BackgroundWorkers;
using Volo.Abp.Threading;

namespace SyncWayBill
{
    /// <summary>
    /// 重发失败数据
    /// </summary>
    public class RegSendWorker : AsyncPeriodicBackgroundWorkerBase
    {
        private readonly SendLoadService _sendLoadService;
        public RegSendWorker(AbpTimer timer,
                IServiceScopeFactory serviceScopeFactory,
                SendLoadService sendLoadService) : base(timer, serviceScopeFactory)
        {
            Timer.Period = 1000 * 60 * 60 * 4; //10 minutes
            _sendLoadService = sendLoadService;
            // Timer.Period = 2000;
        }
        protected override async Task DoWorkAsync(
         PeriodicBackgroundWorkerContext workerContext)
        {
            //Logger.LogInformation("重发任务");
            _sendLoadService.RegSend();
        }
    }
}
